import { format } from "date-fns";

const DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm";
const DATE_FORMAT = "yyyy-MM-dd";

export function formatToDateTime(date: Date | number, formatStr = DATE_TIME_FORMAT): string {
  return format(date, formatStr);
}

export function formatToDate(date: Date | number, formatStr = DATE_FORMAT): string {
  return format(date, formatStr);
}

export function formatToDateMonth(date: Date | number): string {
  return format(date, "yyyy-MM");
}
